<?php
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/logic/CustomCommand.php';
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/factory/DaoFactory.php';
	
	error_reporting (E_ALL ^ E_NOTICE);
	
	$debug = $_SESSION['debug'];
	
	/*
	 * Class to select phones by natural customer id number
	 */
	class CommandSelectPhonesByNaturalCustomerIdNumber extends CustomCommand {
		/*
		 * Constructor of the class
		 */
		public function __construct($ci) {
			$this -> ciRif = $ci;
		}
		
		/*
		 * Method to execute to select phones by natural customer id number
		 */
		public function execute() {
			$daoFactory = DaoFactory :: getMySqlDaoFactory();
			$ipad = $daoFactory -> getMySqlPhoneAccessDao();			
			$sentence = $ipad -> selectPhonesByNaturalCustomerIdNumber($this -> ciRif);
			
			$phones = '';
			while ($row = mysql_fetch_array($sentence)) {
				$phones .= $row['phone'] . "\n";
			}
			
			$this -> result = $phones;
		}
	}
?>